package com.migo.service.impl;

import com.migo.dao.MgAudioInfoEnDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.migo.dao.MgAudioInfoDao;
import com.migo.entity.MgAudioInfoEntity;
import com.migo.service.MgAudioInfoService;



@Service("mgAudioInfoService")
public class MgAudioInfoServiceImpl implements MgAudioInfoService {
	@Autowired
	private MgAudioInfoDao mgAudioInfoDao;
	@Autowired
	private MgAudioInfoEnDao mgAudioInfoEnDao;


	/**
	 *  查询音乐的明细列表
	 * @param map
	 * @return
	 */
	@Override
	public List<MgAudioInfoEntity> queryAudioInfoList(Map<String, Object> map){
		if(!map.containsKey("language")){
			map.put("language","en");
		}
		String language = (String) map.get("language");
		List<MgAudioInfoEntity> audioInfoList;
		if("zh".equals(language)){
			audioInfoList =mgAudioInfoDao.queryAudioInfoList(map);
		}else if("en".equals(language)){
			audioInfoList =mgAudioInfoDao.queryAudioInfoEnList(map);
		}else{
			// 默认英文的
			audioInfoList = mgAudioInfoDao.queryAudioInfoEnList(map);
		}
		return audioInfoList;
	}

	@Override
	public MgAudioInfoEntity queryObject(Integer id){
		return mgAudioInfoDao.queryObject(id);
	}
	
	@Override
	public List<MgAudioInfoEntity> queryList(Map<String, Object> map){
		return mgAudioInfoDao.queryList(map);
	}
	
	@Override
	public int queryTotal(Map<String, Object> map){
		return mgAudioInfoDao.queryTotal(map);
	}
	@Override
	public int queryTotalList(Map<String, Object> map){
		return mgAudioInfoDao.queryTotalList(map);
	}
	@Override
	public int queryTotalListcn(Map<String, Object> map){
		return mgAudioInfoDao.queryTotalListcn(map);
	}

	
	@Override
	public void save(MgAudioInfoEntity mgAudioInfo){
		mgAudioInfoDao.save(mgAudioInfo);
	}
	
	@Override
	public void update(MgAudioInfoEntity mgAudioInfo){
		mgAudioInfoDao.update(mgAudioInfo);
	}
	
	@Override
	public void delete(Integer id){
		mgAudioInfoDao.delete(id);
	}
	
	@Override
	public void deleteBatch(Integer[] ids){
		mgAudioInfoDao.deleteBatch(ids);
	}
	
}
